#pragma once
#include <stdio.h>
#include <stdint.h>
#include <stdarg.h>
#include "base/core/com_define.h"

class File 
{
public:
	virtual size_t Read(char *buf, size_t len) = 0;
	virtual int    ReadLine(char *buf, int len) = 0;
	virtual size_t Write(const char *buf, size_t len) = 0;
	virtual size_t Write(const char* fmt, ...) = 0;
	virtual size_t WriteVaList(const char* fmt, va_list ap) = 0;
	virtual size_t GetSize() = 0;

	virtual bool IsEof() = 0;
	virtual bool IsError() = 0;

	virtual int  Seek(size_t offset, int origin) = 0;
	virtual int  Sync() = 0;

	static bool    IsFileExist(const char* filename);
	static bool    Rename(const char* oldname, const char* newname);

protected:
	File() {}
	virtual ~File() {}
};

File* FileOpen(const char *path, const char *mode);
bool  FileClose(File *file);
